package com.kaifamiao.chars;

public class TestCharacterSequence {

    public static void main(String[] args) {

        // 一个char数组本身就是一个的字符序列
        char[] chars = { '挺', '适', '合', '睡', '觉' };

        CharSequence cs = new CharacterSequence( chars );
        System.out.println( cs ); // cs != null ? cs.toString() : "null"

        chars[0] = '不';

        System.out.println( cs );
        System.out.println( cs.length() );

        char ch = cs.charAt( 3 );
        System.out.println( ch );

        CharSequence x = cs.subSequence( 1, 5 );
        System.out.println( x );
    }

}
